(function() {
	'user strict'
	
	define(['jquery'], function(jquery) {
		
		if(typeof jQuery === 'undefined') {	//检测jquery依赖项
			throw new Error('jquery依赖项未能加载');
		}
		return {
			auditModal: function(modalOuterDivId) { 
				var sAuditModal = '<div class="modal fade" id="tip_modal" tabindex="-1" aria-hidden="true">' +
				'<div class="modal-dialog">' +
					'<div class="modal-content big-warp">' +
						'<div class="modal-header">' +
						'<button style="float: left;" type="button" class="btn btn-sm" id="config_out_sure">导出</button>'+
							'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
						'</div>' +
						'<div class="modal-body" id="tip_modal_body"></div>' +
					'</div>' +
				'</div>' +
			'</div>'	;
			if($('#tip_modal').length < 1) {
				$('#' + modalOuterDivId).append(sAuditModal);
			}
			return {modalId: "tip_modal", modalBodyId: "tip_modal_body"};
			},
			configModal: function(modalOuterDivId){ 
				var sConfigModal = '<div class="modal fade" id="config_modal" tabindex="-1" aria-hidden="true">' +
						'<div class="modal-dialog">' +
							'<div class="modal-content small-box">' +
								'<div class="modal-header">' +
									'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
									'<h3 class="modal-title">提示</h3>' +
								'</div>' +
								'<div class="modal-body" id="config_modal_body"></div>' +
								'<div class="modal-footer">' +
									'<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>' +
									'<button type="button" class="btn btn-sm" id="config_btn_sure">确定</button>' +
								'</div>' +
							'</div>' +
						'</div>' +
					'</div>'	;
					if($('#config_modal').length < 1) {
						$('#' + modalOuterDivId).append(sConfigModal);
					}
					return {modalId: "config_modal", modalBodyId: "config_modal_body", btnSure: "config_btn_sure"};
				},
			tipModal: function(modalOuterDivId){ 
				var sTipModal = '<div class="modal fade" id="tip_modal" tabindex="-1" aria-hidden="true">' +
						'<div class="modal-dialog">' +
							'<div class="modal-content small-box">' +
								'<div class="modal-header">' +
									'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
									'<h3 class="modal-title">提示</h3>' +
								'</div>' +
								'<div class="modal-body" id="tip_modal_body"></div>' +
								'<div class="modal-footer">' +
									'<button type="button" class="btn btn-sm" data-dismiss="modal">确定</button>' +
									/*'<button type="button" class="btn btn-success" id="exception_btn_sure">确定</button>' +*/
								'</div>' +
							'</div>' +
						'</div>' +
					'</div>'	;
					if($('#tip_modal').length < 1) {
						$('#' + modalOuterDivId).append(sTipModal);
					}
					return {modalId: "tip_modal", modalBodyId: "tip_modal_body"};
				},	
			repeatModal: function(modalOuterDivId){ 
				var sRepeatModal = '<div class="modal fade" id="repeat_modal" tabindex="-1" aria-hidden="true">' +
						'<div class="modal-dialog">' +
							'<div class="modal-content small-box">' +
								'<div class="modal-header">' +
									'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
									'<h3 class="modal-title">建议</h3>' +
								'</div>' +
								'<div class="modal-body" id="repeat_modal_body"></div>' +
								'<div class="modal-footer">' +
									/*'<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>' +*/
									'<button type="button" class="btn btn-sm" id="repeat_btn_sure">确定</button>' +
								'</div>' +
							'</div>' +
						'</div>' +
					'</div>'	;
					if($('#repeat_modal').length < 1) {
						$('#' + modalOuterDivId).append(sRepeatModal);
					}
					return {modalId: "repeat_modal", modalBodyId: "repeat_modal_body", btnSure: "repeat_btn_sure"};
			},
				
			detailModal: function(modalOuterDivId, detailTitle){ 
				var sDetailModal = '<div class="modal fade" id="detail_modal" tabindex="-1" aria-hidden="true">' +
					'<div class="modal-dialog">' +
						'<div class="modal-content small-box">' +
							'<div class="modal-header">' +
								'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
								'<h3 class="modal-title">'+ detailTitle +'</h3>' +
							'</div>' +
							'<div class="modal-body" id="detail_modal_body"></div>' +
							'<div class="modal-footer">' +
								/*'<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>' +*/
								'<button type="button" class="btn btn-sm" id="detail_btn_sure">关闭</button>' +
							'</div>' +
						'</div>' +
					'</div>' +
				'</div>'	;
				if($('#detail_modal').length < 1) {
					$('#' + modalOuterDivId).append(sDetailModal);
				}
				return {modalId: "detail_modal", modalBodyId: "detail_modal_body", btnSure: "detail_btn_sure"};
			},
				
			readOnlyModal: '<div class="modal fade" id="read_only_modal" tabindex="-1">' +
								'<div class="modal-dialog">' +
								'<div class="modal-content small-box">' +
									'<div class="modal-header">' +
										'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
										'<h3 class="modal-title">用户拥有的角色</h3>' +
									'</div>' +
									'<div class="modal-body col-md-12" id="read_only_body"></div>' +
									'<div class="modal-footer">' +
									  	'<button type="button" class="btn btn-sm" data-dismiss="modal">关闭</button>' +
									'</div>' +
								'</div>' +
							'</div>' +
						'</div>',
			//modalOuterDivId: 包含modal的div的id，可以是页面最大div
			//返回一个body生成的id，可以根据id加载数据
			loadCreateModal: function(modalOuterDivId, title){
				var sCreateModal = '<div class="modal fade" id="create_modal" tabindex="-1">' +
									'<div class="modal-dialog">' +
									'<div class="modal-content small-box">' +
										'<div class="modal-header">' +
											'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
											'<h3 class="modal-title">'+ title +'</h3>' +
										'</div>' +
										'<div class="modal-body col-md-12" id="create_modal_body"></div>' +
										'<div class="modal-footer">' +
										  	'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>' +
											'<button type="button" class="btn btn-sm " id="create_btn_sure">确定</button>' +
										'</div>' +
									'</div>' +
								'</div>' +
							'</div>';
				if($('#create_modal').length < 1) {
					$('#' + modalOuterDivId).append(sCreateModal);
				}
				return {modalId: "create_modal", modalBodyId: "create_modal_body", btnSure: "create_btn_sure"};
			},
			
			//modalOuterDivId: 包含modal的div的id，可以使页面最大div
			loadUpdateModal: function(modalOuterDivId, title){
				var sUpdateModal = '<div class="modal fade" id="update_modal" tabindex="-1">' +
										'<div class="modal-dialog">' +
										'<div class="modal-content small-box">' +
											'<div class="modal-header">' +
												'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
												'<h3 class="modal-title">'+ title +'</h3>' +
											'</div>' +
											'<div class="modal-body col-md-12" id="update_modal_body"></div>' +
											'<div class="modal-footer">' +
											  	'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>' +
												'<button type="button" class="btn btn-sm" id="update_btn_sure">确定</button>' +
											'</div>' +
										'</div>' +
									'</div>' +
								'</div>';
				if($('#update_modal').length < 1) {
					$('#' + modalOuterDivId).append(sUpdateModal);
				}
				return {modalId: "update_modal", modalBodyId: "update_modal_body", btnSure: "update_btn_sure"};
			},
			
			//返回一个body生成的id，可以根据id加载数据
			loadBoxCreateModal: function(modalOuterDivId, title){
				var sCreateModal = '<div class="modal fade" id="create_modal" tabindex="-1">' +
									'<div class="modal-dialog">' +
									'<div class="modal-content big-warp">' +
										'<div class="modal-header">' +
											'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
											'<h3 class="modal-title">'+ title +'</h3>' +
										'</div>' +
										'<div class="modal-body col-md-12" id="create_modal_body"></div>' +
										'<div class="modal-footer">' +
										  	'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>' +
											'<button type="button" class="btn btn-sm " id="create_btn_sure">确定</button>' +
										'</div>' +
									'</div>' +
								'</div>' +
							'</div>';
				if($('#create_modal').length < 1) {
					$('#' + modalOuterDivId).append(sCreateModal);
				}
				return {modalId: "create_modal", modalBodyId: "create_modal_body", btnSure: "create_btn_sure"};
			},
			
			//modalOuterDivId: 包含modal的div的id，可以使页面最大div
			loadBoxUpdateModal: function(modalOuterDivId, title){
				var sUpdateModal = '<div class="modal fade" id="update_modal" tabindex="-1">' +
										'<div class="modal-dialog">' +
										'<div class="modal-content big-warp">' +
											'<div class="modal-header">' +
												'<button type="button" class="close" data-dismiss="modal">&times;</button>' +
												'<h3 class="modal-title">'+ title +'</h3>' +
											'</div>' +
											'<div class="modal-body col-md-12" id="update_modal_body"></div>' +
											'<div class="modal-footer">' +
											  	'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>' +
												'<button type="button" class="btn btn-sm" id="update_btn_sure">确定</button>' +
											'</div>' +
										'</div>' +
									'</div>' +
								'</div>';
				if($('#update_modal').length < 1) {
					$('#' + modalOuterDivId).append(sUpdateModal);
				}
				return {modalId: "update_modal", modalBodyId: "update_modal_body", btnSure: "update_btn_sure"};
			},
			
			roleUserModal: function (modalOuterDivId) {
				var sRoleUserModal ='<div class="modal fade" id="role_user_modal" tabindex="-1">' +
										'<div class="modal-dialog">' +
											'<div class="modal-content small-box">' +
												'<div class="modal-header">' +
													'<h3 class="modal-title">角色拥有的用户</h3>' +
												'</div>' +
												'<div class="modal-body col-md-12" id="role_user_body"></div>' +
												'<div class="modal-footer">' +
												  	'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>' +
												  	'<button type="button" class="btn btn-sm" id="role_user_btn_sure">确定</button>' +
												'</div>' +
											'</div>' +
										'</div>' +
									'</div>';
				if($('#role_user_modal').length<1) {
				$('#' + modalOuterDivId).append(sRoleUserModal);
				}
				return {modalId: "role_user_modal", modalBodyId: "role_user_body", btnSure: "role_user_btn_sure"};
			}
			
		};
	});
})();